package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"strconv"
	"time"

	"github.com/lzppppppp/virapaksa-go/internal/monitor_show/service"
)

func main() {

	typeOfData := flag.String("type", "process", "Path to the configuration file")
	flag.Parse()

	InitConfig()
	service.GetData("./list.txt", *typeOfData)
}

func InitConfig() {

	timeUnix := time.Now().Unix()
	t := strconv.FormatInt(timeUnix, 10)
	// log库初始化
	file := "./keywords-" + t + ".log"
	logFile, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
	if err != nil {
		fmt.Println("errrrrrrrr")
		return
	}
	log.SetOutput(logFile)
	log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
}
